package com.example.main.fragment

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.LinearLayoutManager
import com.example.lib_base.mvvm.BaseFragment
import com.example.main.R
import com.example.main.adapter.PublicAdapter
import com.example.main.databinding.FragmentAnnouncementBinding
import com.example.main.viewmodel.PublicViewModel
import dagger.hilt.android.AndroidEntryPoint

@AndroidEntryPoint
class AnnouncementFragment : BaseFragment<FragmentAnnouncementBinding,PublicViewModel>() {
    lateinit var publicAdapter: PublicAdapter
    override fun initView() {
        publicAdapter = PublicAdapter()
        biding.rvPublic.adapter=publicAdapter
        biding.rvPublic.layoutManager=LinearLayoutManager(context)


    }

    override fun initData() {
        vm.noticeSuccess.observe(this){
            publicAdapter.data.clear()
            publicAdapter.data.addAll(it)
            publicAdapter.notifyDataSetChanged()
        }

    }

    override fun onResume() {
        super.onResume()
        vm.getNotice(1,20)
    }


}